<template>
  <div class="head-container">
    <!-- 搜索 -->
    <el-input v-model="query.orderCode" clearable placeholder="工单编号" style="width: 200px;" class="filter-item" @keyup.enter.native="toQuery"/>
    <el-select v-model="query.status" :style="style" class="filter-item" placeholder="工单状态">
      <el-option
        v-for="(item, index) in statusList"
        :key="item.label + index"
        :label="item.label"
        :value="item.value"/>
    </el-select>
    <!-- <el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
      <el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
    </el-select> -->
    <el-button class="filter-item" size="mini" type="success" icon="el-icon-search" @click="toQuery">搜索</el-button>
    <!-- 新增 -->
    <!-- <div style="display: inline-block;margin: 0px 2px;">
      <el-button
        v-permission="['ADMIN','TWORKORDER_ALL','TWORKORDER_CREATE']"
        class="filter-item"
        size="mini"
        type="primary"
        icon="el-icon-plus"
        @click="$refs.form.dialog = true">新增</el-button>
      <eForm ref="form" :is-add="true"/>
    </div> -->
  </div>
</template>

<script>
import eForm from './form'
import { getDictDetails } from '@/api/dictDetail'
export default {
  components: { eForm },
  props: {
    query: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      queryTypeOptions: [
        { key: 'orderCode', display_name: '工单编号' },
        { key: 'status', display_name: '工单状态' },
        { key: 'acceptTime', display_name: '接单时间' }
      ],
      statusList: []
    }
  },
  created() {
    this.getOrderStates()
  },
  methods: {
    toQuery() {
      this.$parent.page = 0
      this.$parent.init()
    },
    getOrderStates() {
      getDictDetails('order_status').then(res => {
        this.statusList = res.content
      })
    }
  }
}
</script>
